package com.appcan.base;

import java.rmi.RemoteException;

/**
 * 涓氬姟澶勭悊寮傚父绫伙紝閽堝WEB搴旂敤寮�彂涓粺涓�鐞嗗紓甯�
 * 鐢ㄦ硶锛�
 * public class Test{
 * 	...
 * 	public void errorTest() throws BusinessException{
 * 		throw new BusinessException(this, "my test");
 * 	}
 * }
 *
 */

public class BusinessException extends RemoteException {
	
	static final long serialVersionUID = 2743593455620093008L;
	
	/**
	 * 鏋勯�涓氬姟寮傚父瀹炰緥
	 * @param c		鍙戠敓寮傚父鐨勭被鐨勭被鍨嬶紝閽堝闈欐�鏂规硶涓嚭鐜颁笟鍔″紓甯哥殑鎯呭喌
	 * @param msg	涓氬姟寮傚父淇℃伅
	 */
	public BusinessException(Class c, String msg){
		super(msg);
		if(msg != null){			
			RunTimeLogger.error(c, msg);
		}		
	}
	/**
	 * 鏋勯�涓氬姟寮傚父瀹炰緥
	 * @param o		鍙戠敓寮傚父鐨勭被鐨勫疄渚�
	 * @param msg	涓氬姟寮傚父淇℃伅
	 */
	public BusinessException(Object o, String msg){
		super(msg);
		if(msg != null && o != null){
			RunTimeLogger.error(o, msg);
		}
	}
	/**
	 * 鏋勯�涓氬姟寮傚父瀹炰緥
	 * @param c		鍙戠敓寮傚父鐨勭被鐨勭被鍨嬶紝閽堝闈欐�鏂规硶涓嚭鐜颁笟鍔″紓甯哥殑鎯呭喌
	 * @param msg	涓氬姟寮傚父淇℃伅
	 * @param t     涓氬姟澶勭悊涓嚭鐜扮殑寮傚父
	 */
	public BusinessException(Class c, String msg, Throwable t){
		super(msg, t);
		if(msg != null){
			RunTimeLogger.error(c, msg, t);
		}
	}
	/**
	 * 鏋勯�涓氬姟寮傚父瀹炰緥
	 * @param o		鍙戠敓寮傚父鐨勭被鐨勫疄渚�
	 * @param msg	涓氬姟寮傚父淇℃伅
	 * @param t     涓氬姟澶勭悊涓嚭鐜扮殑寮傚父
	 */
	public BusinessException(Object o, String msg, Throwable t){
		super(msg, t);
		if(msg != null && o != null){
			RunTimeLogger.error(o, msg, t);
		}
	}

}
